
<style>
td.red {
  background-color: #FFCCCC;
}
td.yellow {
  background-color: #FFFFCC;
}
.derivatives {font-size: 80%; color: gray}
</style>


<% jquery_path = File.expand_path(File.join(Redcar.root, %w(plugins html_view assets jquery-1.4.min.js))) %>
<% json_path   = File.expand_path(File.join(Redcar.root, %w(plugins html_view assets json2.js))) %>
<% redcar_css  = File.expand_path(File.join(Redcar.root, %w(plugins html_view views default.css))) %>
<% watermark   = File.expand_path(File.join(Redcar.root, %w(plugins html_view views watermark-48.png))) %>
<script type="text/javascript" src="file://<%= jquery_path %>"></script>
<script type="text/javascript" src="file://<%= json_path %>"></script>
<link rel="stylesheet" href="file://<%= redcar_css %>" type="text/css" media="screen">

<div id="top">
  <img src="file://<%=watermark%>" id="watermark"/>
<h1>Plugin Manager</h1>
</div>

<div class="main">
<h4>Loaded Plugins</h4>
<%= plugin_table(Redcar.plugin_manager.loaded_plugins) %>

<h4>Disabled Plugins</h4>
<%= plugin_table(Redcar.plugin_manager.disabled_plugins) %>

<h4>Unloaded Plugins</h4>
<%= plugin_table(Redcar.plugin_manager.unloaded_plugins) %>

<h4>Unreadable definitions</h4>
<%= plugin_table(Redcar.plugin_manager.unreadable_definitions) %>

<h4>Plugins with Errors</h4>
<%= plugin_table(Redcar.plugin_manager.plugins_with_errors) %>

<h4>Browser Details</h4>
<script language="javascript">
  $("a").click(function(e) {
    e.preventDefault();
    var action = this.innerText.toLowerCase() + 'Plugin';
    var record = $(this).parent().parent();
    var pluginName = record.find(".plugin-name").text();
    try {
      response = Controller[action](pluginName);

      if( response ) {
        if( response['message'] ) alert(response['message']);
        if( response['label'] ) this.innerText = response['label'];
      }
    } catch(e) {
      alert(e.message);
    }
  });
</script>


<script type="text/javascript">
var browser=navigator.appName;
var b_version=navigator.appVersion;
var version=parseFloat(b_version);

document.write("<div class='inset'>");
document.write("<p><b>Browser name:</b> "+ browser);
document.write("<br />");
document.write("<b>Browser version:</b> "+ b_version);
document.write("</p></div>");
</script>
</div>
